The Differential System allows you to implement an iterative system of equations.
Uses include simple physical modeling, fractals, and integration.
Each equation is specified using derivatives, technically: difference equations.
The object will then iterate the equations to produce output values.
The popup panel for this object has three sections:
1. Equations and Outputs
2. Initial Value control
3. Approximation control
Equations and Output
This object calculates a system of derivatives represented in state space format.
The highest order derivative is defined with an equation.
The Differential System object will approximate all lower derivatives.
Derivatives are always with respect to time.
Up to six seperate equations may be simultaneously approximated.
System variables and derivatives may be freely mixed amoungst the equations.
This makes it posible to simulate multi dimensional systems.
Each equation represents one system variable and all it's derivatives.
The highest order derivative is specified in the left columns.
The equation for the derivative is spefied in the middle column.
The desired output values are specified in the right columns.
For example, the formula for a mass-spring-damper is:
Where: m = mass, c = damping value, k = spring constant and f(t) is the driving force.
To implement this formula,
first rearrange the equation to isolate the highest derivative on the left side.
Then rename the variables.
 |
d2X = b0 + a1*X1 + a0*X0 |
Where b0 , a1 and a0 are now external inputs.
b0 represents f(t)/m, a1 represents -c/m and a0 represents -k/m.
On the popup panel, enable the dx button.
Select 2 to indicate d2x.
Enter the right side of the equation by pressing the button and using the Equation Builder.
Select derivatives for output.
x is the position of the mass, x1 is it's velocity, x2 is it's acceleration.
Initial Value control
At any given time, the values of the system variables may be adjusted externally.
This is accomplished by specifying how and what to adjust,
then using the t input trigger.
t is shared by all initial values.
Triggering t will adjust all the specified inputs at the same time.
If an initial value input is not connected, it's value is assumed to be zero.
t may be set to trigger on positive, negative or both edges.
Or, it may to set to trigger continously as long as the gate is active.
To set the position of the mass in the above example:
1. Select the x to display the x system variables.
2. Select X0 to create the input pin.
3. Select = to cause X0 is to be set when t receives a trigger.
Use the same procedure to adjust the velocity (X1)
Approximation control
Settings and pins in this group define how and when to iterate the system.
The s input trigger can be used to single-step the equations.
Connecting a signal source to this input will cause the system to iterate only when a trigger is received.
Otherwise the outputs will remain frozen at their previous values.
When not connected, the object will iterate every sample.
The initial value trigger (t) is always active, even if the system is not iterating.
The h input pin is the step size.
It tells the object how far ahead to approximate the system.
When not connected, h is assumed to be 1.0.
This input can be used to rescale the entire system.
A common problem in iterative systems is that the system variables may reach the state where they steadily increase in value with no hope of ever returning.
Technical terms for this include runaway, escape to infinity and explode.
The differential system uses three techniques to eliminate this problem:
saturation, damping and approximation order.
All three methods introduce artifacts.
Saturation is the catch-all method and can not be turned off.
If any system variable is larger than the saturation level, it is clipped.
The saturation level may be set to 2.0 or 8.0.
Sometimes it is nessesary to rescale the external parameters of the system to account for the clipping levels.
Artifacts of saturation are hard-clipping.
This can be displayed as red ring using the show button.
Sometimes clipping can cause uncontrollable oscillation.
This happens when one of the system variables bounces from one extreme to the other.
Damping is optionally implemented using the m input.
It is a percentage input that reduces all the system variables every iteration.
The concept is to gently pull the system variables twards zero so they don't go out of bounds.
If used, m should be a small value.
Artifacts of damping show up as an amplitude envelope that expotentially decreases over time.
One use of damping is to reset the system when saturation is occuring.
Do this by using a comparison object connected to the output.
When the ouput gets too big, the comparitor can raise the value at m via a multiply knob.
Approximation Order is the most accurate method of reducing runaway.
There are two settings, linear (Lin) and Runge-Kutta (RK).
In linear approximation, each system variable is iterated once, in a straight line, at a distance specified by h.
With Runge-Kutta approximation, each system variable is sucessivly iterated four times, at various distances, then averaged.
Artifacts of these methods show up in the stability at higher frequencies.
Linear approximation behaves very poorly and will runaway quickly at fairly low frequencies.
However, for purely iterative equations, such as fractals or population models, linear approximation may be required.
RK does much better at higher frequencies and is often required with any formula using a resonater.
RK tends to introduce a small amplitude decay.
Usually on the order of several tens of seconds at full sampling rate.
|